package gc;/** * @Author: Beating Pupils * @Date: 2020/7/29 07:58 * @Description: 栈内存溢出:设置栈内存为1M，演示递归导致的oom异常,1M时大概需要递归5千多次 */public class OOM1 {    public static long counter = 0;    public static void main(String[] args) {        work();    }    public static void work(){        System.out.println("目前是第"+ (++counter) +"次调用方法");        work();    }}